import axios from 'axios'


const CancelToken = axios.CancelToken;


axios.defaults.baseURL = 'http://www.kbb123.com/';

//设置请求超时 10s
axios.defaults.timeout = 10000;


export default {
    //get请求
    get(url, param) {
        return axios({
            method: 'get',
            url,
            params: param,
            // cancelToken: new CancelToken(c => {
            //     cancel = c
            // })
        })
    },
    //post请求
    post(url, param) {
        return axios({
            method: 'post',
            url,
            data: param,
            // cancelToken: new CancelToken(c => {
            //     cancel = c
            // })
        })
    }
}